﻿锘 ? / #include <iostream>
//using namespace std;
//class person
//{
//protected:
//	string name = "mary";
//	int year = 2005;
//public:
//	void print()
//	{
//		cout << name << " " << year << endl;
//	}
//};
//class student :public person
//{
//protected:
//	int xuehao;
//};
//class teacher : public person 
//{
//protected:
//	int gonghao;
//};
//int main()
//{
//	student s;
//	teacher t;
//	s.print();
//	t.print();
//	return 0;
//}
//
//#include <iostream>
//using namespace std;
//class CPoint
//{
//protected:
//	double x, y;
//public:
//	CPoint(double x0, double y0):x(x0),y(y0){}
//};
//class CCircle :public CPoint
//{
//protected:
//	double r;
//public:
//	CCircle(double x0, double y0,double r0): CPoint(x0,y0),r(r0){}
//	double area()
//	{
//		return 3.14 * r * r;
//	}
//	void print()
//	{
//		cout << "Circle:(" << x << "," << y << "),"<<r<<endl;
//		cout << "Area:" << area() << endl;
//	}
//};
//class Cylinder :public CCircle
//{
//protected:
//	double h;
//public:
//	Cylinder(double x1, double y1, double r1, double _h):CCircle(x1,y1,r1),h(_h){}
//	double v()
//	{
//		return (3.14 * r * r * h);
//	}
//	void print()
//	{
//		cout << "Cylinder:(" << x << "," << y << ")," << r << "," << h<<endl;
//			cout << "Volume:" << v() << endl;
//	}
//};
//int main()
//{
//	double x0, y0, r0,x1,y1,r1,h;
//	cin >> x0 >> y0 >> r0>>x1>>y1>>r1>>h;
//	CCircle ccricle(x0,y0,r0);
//	ccricle.print();
//	Cylinder cy(x1, y1, r1, h);
//	cy.print();
//	return 0;
//#include <iostream>
//#include <math.h>
//using namespace std;
//class C2D
//{
//protected:
//	int x, y;
//public:
//	C2D(int x1, int y1) :x(x1), y(y1) {}
//	double getDistance()
//	{
//		return sqrt(x*x + y*y);
//	}
//};
//class C3D:public C2D
//{
//protected:
//	int z;
//public:
//	C3D(int x1,int y1,int z1):C2D(x1,y1),z(z1){}
//	double getDistance1()
//	{
//		return sqrt(x *x + y*y+ z *z);
//	}
//};
//int main()
//{
//	int x1, y1,x2,y2,z2,x3,y3,z3;
//	cin >> x1 >> y1 >> x2 >> y2 >> z2 >> x3 >> y3 >> z3;
//	C2D c2d(x1, y1);
//	cout << c2d.getDistance() << endl;
//	C3D c3d(x2, y2, z2);
//	cout << c3d.getDistance1() << endl;
//	C3D c3d1(x3, y3, z3);
//	cout << c3d1.getDistance1() << endl<<c3d1.getDistance();
//	return 0;
//}
//#include <iostream>
//using namespace std;
//class Person
//{
//protected:
//	string _name;
//	int _age;
//public:
//	Person(string name,int age):_name(name),_age(age){}
//	void display()
//	{
//		cout << _name << " " << _age << " ";
//	}
//};
//class Score :public Person
//{
//protected:
//	double score;
//public:
//	Score(string name,int age,double score_):Person(name,age),score(score_){}
//	void display()
//	{
//		if (score >= 85)
//			cout << 'A' << endl;
//		else if (score >= 75 && score < 85)
//			cout << 'B' << endl;
//		else if (score >= 65 && score < 75)
//			cout << 'C' << endl;
//		else if (score >= 60 && score < 65)
//			cout << 'D' << endl;
//		else
//			cout << 'F' << endl;
//	}
//};
//int main()
//{
//	int t, age, psscore, ksscore;
//	double zscore;
//	string name;
//	char type;
//	cin >> t;
//	for (int i = 0; i < t; i++)
//	{
//		cin >> type >> name >> age;
//		Person person(name, age);
//		person.display();
//		if (type == 'R')
//		{
//			cin >> psscore >> ksscore;
//			zscore = psscore * 0.4 + ksscore * 0.6;
//			Score score(name,age,zscore);
//			score.display();
//		}
//		else
//		{
//			cin >> ksscore;
//			zscore = ksscore * 0.6;
//			Score score(name, age, zscore);
//			score.display();
//		}
//	}
//	return 0;
//}
//#include <iostream>
//using namespace std;
//class clock1
//{
//protected:
//	int _h, _m, _s;
//public:
//	clock1(int h, int m, int s0) :_h(h), _m(m), _s(s0) {}
//	void time1(int s)
//	{
//		_s = _s + s;
//		if (_s >= 60)
//		{
//			_m = _m+_s / 60;
//			_s = _s % 60;
//		}
//		if (_m >= 60)
//		{
//			_h =_h+ _m / 60;
//			_m = _m % 60;
//		}
//		if (_h == 24)
//			_h = 0;
//		cout << _h << ":" << _m << ":" << _s << endl;
//	}
//};
//int main()
//{
//	int n,h,m,s0,s1;
//	cin >> n;
//	for (int i = 0; i < n; i++)
//	{
//		cin >> h >> m >> s0 >> s1;
//		clock1 clo(h, m, s0);
//		clo.time1(s1);
//	}
//	return 0;
//}
//#define _CRT_SECURE_NO_WARNINGS
//#include <iostream>
//#include <cstring>
//using namespace std;
//class CDate
//{
//private:
//	int year, month, day;
//public:
//	CDate(int y, int m, int d) :year(y), month(m), day(d){}
//	int getyear()
//	{
//		return year;
//	}
//	int getmonth()
//	{
//		return month;
//	}
//	int getday()
//	{
//		return day;
//	}
//	int month1[13] = { 0,31,28,31,30,31,30,31,31,30,31,30,31 };
//	bool isLeap()
//	{
//		if (year % 400 == 0 || year % 4 == 0 && year % 100 != 0)
//			return true;
//		else
//			return false;
//	}
//	bool check()
//	{
//		if (isLeap() == true && month == 2 && day > 29)
//			return false;
//		if(month<1||month>12||day<1||day>31||day>month1[month])
//			return false;
//		return true;
//	}
//};
//class COldId
//{
//protected:
//	char* pid15;
//	string pname;
//	CDate birthday; 
//public:
//	COldId(char* pid, string pname_, CDate& day) : pname(pname_), birthday(day)
//	{
//		pid15= new char[strlen(pid) + 1];
//		strcpy(pid15, pid);
//	}
//	bool check()
//	{
//		
//		if (birthday.check() != true)
//			return false;
//		if (strlen(pid15) != 15)
//			return false;
//		else
//			return true;
//	}
//	~COldId()
//	{
//		delete[]pid15;
//	}
//};
//class cnew :public COldId
//{
//protected:
//	char* pid18;
//	CDate date;
//	int yxq_;
//public:
//	cnew(char* pid, string pname_, CDate& day,char *pid8,CDate &date_,int yxq):COldId(pid,pname_,day),date(date_),yxq_(yxq)
//	{
//		pid18 = new char[strlen(pid8) + 1];
//		strcpy(pid18, pid8);
//	}
//	~cnew()
//	{
//		delete[]pid18;
//	}
//	bool check()
//	{
//		int yearid = (pid15[6] - '0') * 10 + (pid15[7] - '0');
//		int yearbir = birthday.getyear() % 100;
//		if (yearid != yearbir)
//		{
//			return false;
//		}
//		if (date.check() != true)
//			return false;
//		if (strlen(pid18) != 18)
//			return false;
//		if (((date.getyear() + yxq_) < 2021) || ((date.getyear() + yxq_) == 2021 && date.getmonth() < 11) || ((date.getyear() + yxq_) == 2021 && date.getmonth() == 11 && date.getday() <= 9)) {
//			return false;
//		}
//		for (int i = 0; i < 6; i++)
//		{
//			if (pid15[i] != pid18[i])
//				return false;
//		}
//		if (pid18[6] != '1' || pid18[7] != '9')
//			return false;
//		for (int j = 8; j < 15; j++)
//		{
//			if (pid15[j] != pid18[j + 2])
//				return false;
//		}
//		int sum = 0;
//		int date1[17] = { 7,9,10,5,8,4,2,1,6,3,7,9,10,5,8,4,2 };
//		for (int i = 0; i < 17; i++)
//		{
//			if (pid18[i] < '0' || pid18[i]>'9')
//				return false;
//			else
//			sum = sum + (pid18[i] - '0') * date1[i];
//		}
//		sum = sum % 11;
//		char num[11] = { '1','0','X','9','8','7','6','5','4','3','2' };
//		if (pid18[17] != num[sum])
//		{
//			return false;
//		}
//		return true;
//	}
//	void print()
//	{
//		cout << pname << endl;
//		if (check() != false)
//		{
//			if (yxq_ < 100)
//				cout << pid18 << " " << date.getyear() << "骞? << date.getmonth() << "鏈? << date.getday() << "鏃? << " " << yxq_ <<"骞? << endl;
//			else if (yxq_ == 100)
//				cout << pid18 << " " << date.getyear() << "骞? << date.getmonth() << "鏈? << date.getday() << "鏃? << " " << "闀挎湡" << endl;
//		}
//		else
//			cout << "illegal id" << endl;
//	}
//};
//int main()
//{
//	int t,y1,m1,d1,y2,m2,d2,yxq;
//	string name;
//	char num1[20], num2[20];
//	cin >> t;
//	for (int i = 0; i < t; i++)
//	{
//		cin >> name >> y1 >> m1 >> d1;
//		CDate bir(y1, m1, d1);
//			cin >> num1;
//			cin >> num2;
//		cin >> y2 >> m2 >> d2 >> yxq;
//		CDate date(y2, m2, d2);
//		COldId coldid(num1, name, bir);
//		cnew cnew1(num1, name, bir, num2, date, yxq);
//		cnew1.print();
//		
//	}return 0;
//#include <iostream>
//using namespace std;
//class Person
//{
//protected:
//	int year;
//public:
//	Person(int y) :year(y) {};
//	void print()
//	{
//		cout << year << endl;
//	}
//};
//class Student
//{
//protected:
//	int month;
//public:
//	Student(int m) :month(m) {};
//	void print()
//	{
//		cout << month << endl;
//	}
//};
//class Teacher :public Person, public Student
//{
//protected:
//	int day;
//public:
//	Teacher(int y, int m, int d) :Person(y), Student(m), day(d) {};
//	void print()
//	{
//		cout << day << endl;
//	}
//};
//int main()
//{
//	int y, m, d;
//	cin >> y >> m >> d;
//	Teacher teacher(y,m,d);
//	teacher.Person::print();浣滅敤鍩熻繍绠楃鎴栬€呮敼涓簆rint1/print2
//	teacher.Student::print();
//	teacher.print();//杈撳叆2025 5 26鍙細鎵撳嵃鍑?6锛涜鎯冲畬鏁存墦鍗板嚭鏉ワ紝蹇呴』鍐?
//	return 0;
//
//}
//#include <iostream>
//using namespace std;
//class CVehicle
//{
//protected:
//	int max_speed, speed, w;
//public:
//	CVehicle(int maxs, int v, int weight) :max_speed(maxs), speed(v), w(weight) {};
//	void display()
//	{
//		cout << "Vehicle:" << endl << "max_speed:" << max_speed << endl << "speed:" << speed << endl << "weight:" << w <<endl<< "\n";
//	}
//};
//class CBicycle:virtual public CVehicle
//{
//protected:
//	int h;
//public:
//	CBicycle(int maxs, int v, int weight, int height) :CVehicle(maxs , v,weight), h(height) {};
//	void display()
//	{
//		cout << "Bicycle:" << endl << "max_speed:" << max_speed << endl << "speed:" << speed << endl << "weight:" << w << endl<<"height:"<<h<<endl<<"\n";
//	}
//};
//class CMotocar: virtual public CVehicle
//{
//protected:
//	int seat_num;
//public:
//	CMotocar(int maxs, int v, int weight, int seat) :CVehicle(maxs, v, weight), seat_num(seat) {};
//	void display()
//	{
//		cout << "Motocar:" << endl << "max_speed:" << max_speed << endl << "speed:" << speed << endl << "weight:" << w <<endl<< "seat_num:"<<seat_num<<endl<<"\n";
//	}
//};
//class CMotocycle :public CBicycle, public CMotocar
//{
//public:
//	CMotocycle(int maxs, int v, int weight, int height, int seat) :CVehicle(maxs, v, weight), CBicycle(maxs, v, weight,height), CMotocar(maxs, v,  weight, seat) {};
//	void display()
//	{
//		cout << "Motocycle:" << endl << "max_speed:" << max_speed << endl << "speed:" << speed << endl << "weight:" << w << endl<<"height:" << h <<endl<< "seat_num:" << seat_num <<endl<< "\n";
//	}
//};
//int main()
//{
//	int maxs,v,weight,height,seat;
//	cin >> maxs >> v >> weight >> height >> seat;
//	CMotocycle cmotocycle(maxs, v, weight, height, seat);
//	cmotocycle.CVehicle::display();
//	cmotocycle.CBicycle::display();
//	cmotocycle.CMotocar::display();
//	cmotocycle.CMotocycle::display();
//	return 0;
//}
//#include <iostream>
//using namespace std;
//class CPeople
//{
//protected:
//	string name_, sex_;
//	int age_;
//public:
//	CPeople(string name, string sex, int age) :name_(name), sex_(sex), age_(age) {};
//	void print()
//	{
//		cout << "People:" << endl << "Name: " << name_ << endl << "Sex: " << sex_ << endl << "Age: " << age_ << endl << "\n";
//	}
//};
//class CStudent:virtual public CPeople
//{
//protected:
//	int num_;
//	double score_;
//public:
//	CStudent(string name, string sex, int age, int num, double score) :CPeople(name, sex, age), num_(num),score_(score) {};
//	void print()
//	{
//		cout << "Student:" << endl << "Name: " << name_ << endl << "Sex: " << sex_ << endl << "Age: " << age_ << endl << "No.: " << num_ << endl << "Score: " << score_ << endl << "\n";
//	}
//};
//class CTeacher :virtual public CPeople
//{
//protected:
//	string  position_, department_;
//public:
//	CTeacher(string name, string sex, int age, string position, string department) :CPeople(name, sex, age), position_(position), department_(department) {};
//	void print()
//	{
//		cout << "Teacher:" << endl << "Name: " << name_ << endl << "Sex: " << sex_ << endl << "Age: " << age_ << endl << "Position: " << position_ << endl << "Department: " << department_ << endl << "\n";
//	}
//};
//class CGradOnWork :public CStudent, public CTeacher
//{
//protected:
//	string direction_, tutor_;
//public:
//	CGradOnWork(string name, string sex, int age, int num, double score, string position, string department, string direction, string tutor) :CPeople(name, sex, age), CStudent(name, sex, age, num, score), CTeacher(name, sex, age, position, department), direction_(direction), tutor_(tutor) {};
//	void print()
//	{
//		cout << "GradOnWork:" << endl << "Name: " << name_ << endl << "Sex: " << sex_ << endl << "Age: " << age_ << endl << "No.: " << num_ << endl << "Score: " << score_ << endl << "Position: " << position_ << endl << "Department: " << department_ << endl << "Direction: " << direction_ << endl << "Tutor: " << tutor_ << endl << "\n";
//	}
//};
//int main()
//{
//	string name, sex,department, position, direction, tutor;
//	int age, num;
//	double score;
//	cin >> name >> sex >> age >> num >> score>> position>>department>> direction>> tutor;
//	CGradOnWork work(name, sex, age, num, score, position, department, direction, tutor);
//	work.CPeople::print();
//	work.CStudent::print();
//	work.CTeacher::print();
//	work.CGradOnWork::print();
//	return 0;
#include <iostream>
using namespace std;
class Date
{
protected:
	int year, month, day;
public:
	Date() {};
	Date(int y, int m, int d) :year(y), month(m), day(d) {};
};
class Time
{
protected:
	int hour, min_, second;
public:
	Time() {};
	Time(int h, int min, int s) :hour(h), min_(min), second(s) {};
};
class Work :public Date, public Time
{
protected:
	int id_;
public:
	Work() { };
	Work(int y, int m, int d, int h, int min, int s, int id) :Date(y, m, d), Time(h, min, s), id_(id) {};
	friend bool before(const Work& w1, const Work& w2);
	void print()
	{
		cout << "The urgent Work is No." << id_ << ": " << year << "/" << month << "/" << day << " " << hour << ":" << min_ << ":" << second << endl;
	}
};
bool before(const Work& w1, const Work& w2)
{
	if (w1.year <w2.year || (w1.year == w2.year && w1.month < w2.month) ||
		(w1.year == w2.year && w1.month == w2.month && w1.day <w2.day) || 
		(w1.year == w2.year && w1.month == w2.month && w1.day == w2.day && w1.hour <w2.hour) 
		|| (w1.year == w2.year && w1.month == w2.month && w1.day == w2.day && w1.hour == w2.hour && w1.min_ <w2.min_)
		|| (w1.year == w2.year && w1.month == w2.month && w1.day == w2.day && w1.hour == w2.hour && w1.min_ == w2.min_ && w1.second < w2.second))
	{
		return true;
	}
	else
		return false;
}
int main()
{
	int id, y, m, d, h, min, s, i = 0;
	Work p[100];
	while (1)
	{
		cin >> id ;
		if (id == 0)
			break;
		else
		{
			cin >> y >> m >> d >> h >> min >> s;
			Work work(y, m, d, h, min, s, id);
			p[i] = work;
			i++;
		}
	}
	int j, k;
	Work workmin = p[0];
	for (j = 1; j < i; j++)
	{
		if (before(p[j], workmin))
			workmin = p[j];
	}
	workmin.print();
	return 0;
}